
// import request from '@/utils/request';
import request from '../utils/http'
import JSEncrypt from 'jsencrypt'

// 下载文件
export async function downloadFile(params: any): Promise<any> {
  return request('/api/admin/sys_file/download', {
    method: 'get',
    params,
    responseType: 'blob'
  });
}

export interface LoginParamsType {
  username: string;
  password: string;
}

export async function fakeAccountLogin(params: LoginParamsType) {
  return request('/api/sso/auth/rds', {
    method: 'get',
    // params:{token}
  }).then(res => {
    if (res?.data) {
      const encrypt = new JSEncrypt();
      encrypt.setPublicKey(res.data);
      console.log(encrypt.encrypt(params.password))
      params.password = encrypt.encrypt(params.password);
      params.username = encrypt.encrypt(params.username);
      return request('/api/sso/auth/token', {
        method: 'POST',
        data: params,
      });
    }
  })
}

// 下载文件
export async function getPoolList(params: any): Promise<any> {
  return request('/api/research/pool_detail/list', {
    method: 'post',
    params,
  });
}